<!-- BEGIN PAGE HEADING ROW -->
<?php echo $this->Html->script('tinymce/js/tinymce/tinymce.min');?>

<div class="row">
	<div class="col-lg-12">
		<!-- BEGIN BREADCRUMB -->
		<div class="breadcrumbs">
			<ul class="breadcrumb">
				<li> <a href="<?= $this->webroot.'admin' ?>">Trang chủ</a> </li>
				<li> <a href="<?= $this->webroot.'admin' ?>/products/index/<?= $cate_id.'/'.$category_id ?>">Danh sách sản phẩm</a> </li>
				<li class="active"><?php echo isset($this->data[$als]) ? 'Sửa' : 'Thêm mới'?></li>
			</ul>
		</div>
		<!-- END BREADCRUMB -->

		<div class="page-header">
			<h1><?php echo isset($this->data[$als]) ? 'Sửa' : 'Thêm Mới'; ?></h1>
		</div>

		<?php echo $this->element('layout/layout-options')?>

	</div><!-- /.col-lg-12 -->
</div><!-- /.row -->
<!-- END PAGE HEADING ROW -->


<div class="row">
	<div class="col-lg-12">


	<?php echo $this->Session->flash(); ?>

		<div class="portlet portlet-default">
			<div class="portlet-heading">
				<div class="portlet-title">
					<h4><?php echo isset($this->data[$als]) ? 'Sửa' : 'Thêm mới'; ?></h4>
				</div>
				<div class="portlet-widgets">
					<a data-toggle="collapse" data-parent="#accordion" href="#f-3" class=""><i class="fa fa-chevron-down"></i></a>
				</div>
				<div class="clearfix"></div>
			</div>
			<div id="f-3" class="panel-collapse collapse in">
				<div class="portlet-body">
					<?php echo $this->Form->create($als, array('class' => 'form-horizontal', 'type' => 'file'));?>
						<div class="form-group">
							<label class="col-sm-2 control-label">Danh mục</label>
							<div class="col-sm-9">
								<?php echo $this->Form->input($als.'.category_id', array( 'label' => false, 'div' => false, 'class' => 'form-control', 'options' => $categories, 'default' => $category_id ) )?>
							</div>
						</div>

						<div class="form-group">
							<label class="col-sm-2 control-label">Tên</label>
							<div class="col-sm-9">
								<?php echo $this->Form->hidden($als.'.id' )?>
								<?php echo $this->Form->hidden($als.'.cate_id', array('value' => $cate_id, 'name' => 'cate_id') )?>
								<?php echo $this->Form->input($als.'.name', array( 'label' => false, 'div' => false, 'class' => 'form-control', 'placeholder' => 'Nhập tên' ) )?>
							</div>
						</div>
						<!--<div class="form-group">
							<label class="col-sm-2 control-label">Tên gọi khác</label>
							<div class="col-sm-9">
								<?php //echo $this->Form->input($als.'.als', array( 'label' => false, 'div' => false, 'class' => 'form-control alias', 'placeholder' => 'ten-goi-khac' ) )?>
							</div>
						</div>-->
						<div class="form-group">
							<label class="col-sm-2 control-label">Thứ thự</label>
							<div class="col-sm-9">
								<?php echo $this->Form->input($als.'.sort', array( 'label' => false, 'div' => false, 'class' => 'form-control', 'placeholder' => 'Nhập số thứ tự' ) )?>
							</div>
						</div>
						<div class="form-group">
							<label class="col-sm-2 control-label">Miêu tả</label>
							<div class="col-sm-9">
								<?php echo $this->Form->textarea($als.'.desc', array( 'label' => false, 'div' => false, 'class' => 'form-control tnmc', 'placeholder' => 'Nhập nội dung miêu tả' ) )?>
							</div>
						</div>

						<div class="form-group">
							<label class="col-sm-2 control-label">Hình ảnh</label>
							<div class="col-sm-9">

								<?php if(isset($images)):?>
								<ul class="tc-gallery clearfix">
									<?php foreach($images as $img):?>
									<li id="<?php echo $img['Image']['id']; ?>" data-als="<?= $als ?>">

										<img alt="" src="<?php echo PUBLIC_THUMB_SHOW. $img['Image']['image'] ?>" style="width:160px; height: 120px;">

										<div class="tools tools-right">
											<a href="#">
												<i class="fa fa-times text-red"></i>
											</a>
										</div>
									</li>
									<?php endforeach;?>
								</ul>
								<?php endif;?>

								<div class="item mb10 clearfix">
									<input type="file" class="form-control input-xlarge fl mr10" name="data[<?= $als ?>][images][]"/>
									<a href="#" class="btn btn-line btn-primary add"><i class="fa fa-plus icon-only"></i></a>
									<a href="#" class="btn btn-line btn-danger del hide"><i class="fa fa-trash-o icon-only"></i></a>
								</div>
							</div>
						</div>

						<div class="form-actions">
							<div class="form-group">
								<div class="col-sm-offset-2 col-sm-9">
									<button type="submit" class="btn btn-default">Lưu</button>
									<a href="<?= $this->webroot.'admin' ?>/products/index/<?= $cate_id.'/'.$category_id ?>" class="btn">Hủy bỏ</a>
								</div>
							</div>
						</div>
					<?php echo $this->Form->end( ); ?>
				</div>
			</div>
		</div>

	</div><!-- /.col-lg-12  fa-times-->
</div><!-- /.row -->


<?php
	echo $this->Html->script('functions');
	echo $this->Html->script('product/add');
 	echo $this->Html->script('tynimce');
?>
